import request from '@/api/request';
import { getClusterName } from '@/utils/config';

export function getLogs() {
  return request({
    url: `${getClusterName()}/logs`,
    method: 'get',
  })
}

export function getCmds() {
  return request({
    url: `${getClusterName()}/commands`,
    method: 'get',
  })
}

export function getCmdResult(data) {
  return request({
    url: `${getClusterName()}/commands/` + data,
    method: 'get',
  })
}

// 检查脚本名称是否有相同
export function checkScriptName(params) {
  return request({
    url: `${getClusterName()}/scripts`,
    method: 'get',
    params,
  })
}

// 创建脚本生成器
export function createScript(data) {
  return request({
    url: `${getClusterName()}/scripts`,
    method: 'post',
    data,
  })
}
